#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cassert>
#include <math.h>
using namespace std;
using pii = pair<int,int>;
using vi = vector<int>;
#define endl "\n"
#define int int64_t
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FOR0(i,a) FOR(i,0,a)
#define FOR1(i,a) for (int i = (1); i <= (a); ++i)
#define TRAV(a,x) for (auto& a: x)
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
int minAns=0;
int maxAns=0;
FOR0(i,N){
string a;
cin>>a;
int ans=0,ans2=0;
TRAV(i,a){
if(i=='1'){
ans++;
ans2++;
}
}
//int ans=0;
bool vis[M];
FOR0(i,M){
vis[i]=false;
}
int cnt2=0;
for(int i=0;i<M-1;i++){
if(cnt2>=M/4){continue;}
if(a.at(i)=='1' && a.at(i+1)=='1'){
vis[i]=true;
vis[i+1]=true;
i++;
cnt2++;
ans--;
}
}
//int ans2=0;
//bool vis2[M];
FOR0(i,M){
vis[i]=false;
}
int cnt=0;
for(int i=0;i<M-1;i++){
if(cnt>=M/4){continue;}
if(!(a.at(i)=='1' && a.at(i+1)=='1')){
// cout<<" "<<i<<" "<<i+1<<endl;
vis[i]=true;
vis[i+1]=true;
i++;
cnt++;
//ans2++;
}
}
for(int i=0;i<M-1;i++){
if(cnt>=M/4){continue;}
if(vis[i]==false && vis[i+1]==false){
// cout<<" "<<i<<" "<<i+1<<endl;
vis[i]=true;
vis[i+1]=true;
i++;
cnt++;
ans2--;
}
}
minAns+=ans;
maxAns+=ans2;
}
cout<<minAns<<" "<<maxAns<<endl;
return 0;
}
712A - Memory and Crow | 1676C - Most Similar Words |
1681A - Game with Cards | 151C - Win or Freeze |
1585A - Life of a Flower | 1662A - Organizing SWERC |
466C - Number of Ways | 1146A - Love "A" |
1618D - Array and Operations | 1255A - Changing Volume |
1710C - XOR Triangle | 415C - Mashmokh and Numbers |
8A - Train and Peter | 591A - Wizards' Duel |
1703G - Good Key Bad Key | 1705A - Mark the Photographer |
1707A - Doremy's IQ | 1706B - Making Towers |
1325B - CopyCopyCopyCopyCopy | 1649C - Weird Sum |
1324B - Yet Another Palindrome Problem | 525A - Vitaliy and Pie |
879A - Borya's Diagnosis | 1672B - I love AAAB |
1673A - Subtle Substring Subtraction | 1345A - Puzzle Pieces |
711A - Bus to Udayland | 779B - Weird Rounding |
1703D - Double Strings | 1704C - Virus |